<template>
	<page-loading class="wrap" :show='isLoading' mode='if' >
	<view>
		<view class="width-70 u-text-center" v-if="audit">
			<i-icon icon="iconxiaolian" type="multiple" size="160rpx"></i-icon>
			<view class="width-70">您的信息已提交 我们3个工作日内给您反馈</view>
		</view>
		<view class="u-text-center" v-else>
			<i-icon icon="iconshenheshibai" type="multiple" size="160rpx"></i-icon>
			<view class="width-70"><view class="width-70">您的信息未通过审核 请与客服联系更正</view></view>
			<view class="width-80 btn-bg-yellow" @click="call">致电客服</view>
		</view>
	</view>
	</page-loading>
</template>

<script>
import { AddMobileContactData } from '@/utils/common-api.js';
export default {
	data() {
		return {
			// ispass: false,
			audit: false,
			authentication: false,
			bindPhone: false,
			contractNo: false,
			isLoading:false,
			timer:null
		};
	},
	// computed: {
	// 	ispass() {
	// 		if (this.audit===3 && this.authentication  ) {
	// 			this.audit=true
	
	// 		}else if(this.audit===2 && !this.authentication){
	// 			this.audit=false
	// 		}else if(this.audit===1){
	// 			uni.navigateTo({
	// 				url:'/pages_common/pages_me/assets/bindPhone/bindPhone'
	// 			})
				
	// 		}
			
	// 		return false
	// 	},
	// },
	created() {
		// let _this=this
		// this.$nextTick(function(){
			this.timer= setInterval(()=>{
				this.GetCertificationProgress();
			},4000)
			
		// })
	},
	onHide(){
		clearInterval(this.timer)
	},
	onUnload(){
		clearInterval(this.timer)
	},
	onBackPress(e) {
		uni.redirectTo({
			url:'/pages_common/pages_me/assets/assetsManage/assetsManage'
		})
		clearInterval(this.timer)
		return true
	},
	methods: {
		GetCertificationProgress() {
			this.$api.bindbank.GetCertificationProgress({type:1}).then(res => {
				this.isLoading=true
				this.audit=res.data.audit;
				this.authentication=res.data.authentication;
				this.bindPhone=res.data.bindPhone;
				this.contractNo=res.data.contractNo;
				// 1审核中，2失败，3审核通过
				console.log(res);
				if (this.audit===3 && this.authentication) {
					clearInterval(this.timer)
					uni.navigateTo({
						url:'/pages_common/pages_me/assets/bindPhone/bindPhone'
					})
				}else if(this.audit===2 ){
					this.audit=false
					clearInterval(this.timer)
				}else if(this.audit===1){
					this.audit=true
				}
				else if(this.audit===0){
					this.audit=true
					// this.$api.bindbank.IdcardCollectAll().then(res => {})
				}
			});
		},
		call() {
			AddMobileContactData(this.$store.state.userInfoDetail.store.storeId);
			uni.makePhoneCall({
				phoneNumber: '4000909987' //仅为示例
			});
		}
	}
};
</script>

<style scoped lang="scss">
.wrap {
	width: 100%;
	min-height: 100vh;
	background-color: #fff;
	padding-top: 300rpx;
}
.width-70 {
	margin: auto;
	margin-top: 60rpx;
	font-size: 30rpx;
	font-weight: 500;
	color: #666666;
}
.width-80 {
	height: 90rpx;
	line-height: 90rpx;
	font-size: 32rpx;
	margin-top: 200rpx;
}
</style>
